var video = $("video").get(0);

function formatTime(time) {
    console.log('格式化时间:');
    console.log(time);

    var h = Math.floor(time / 3600);
    var m = Math.floor(time % 3600 / 60);
    var s = Math.floor(time % 60);
    return (h < 10 ? "0" + h : h) + ":" + (m < 10 ? "0" + m : m) + ":" + (s < 10 ? "0" + s : s);
}
video.oncanplay = function() {
    $("video").show();
    console.log(video.duration);
    var totalTime = formatTime(video.duration);
    console.log(totalTime);
    $(".total").html(totalTime);
}
$(".switch").on("click", function() {
    if ($(this).hasClass("fa-play")) {
        video.play();
        console.log('播放');
        $(this).addClass('fa-pause').removeClass('fa-play');
    } else {
        video.pause();
        console.log('暂停');
        $(this).addClass('fa-play').removeClass('fa-pause');
    }
})